﻿#region

using System;
using Google.GData.Extensions;
using Google.GData.Extensions.MediaRss;
using Google.YouTube;

#endregion

namespace Y2M.Components
{
    public class Clip
    {
        private const int MaxDescription = 100;

        public Clip(Video video)
        {
            _video = video;
            _thumbnailUrl = video.Thumbnails.Count > 0 ? video.Thumbnails[0].Url : string.Empty;
            _description = video.Description.Ellipse(MaxDescription);
        }

        private readonly Video _video;

        public string Id
        {
            get { return _video.VideoId; }
        }

        private readonly string _description;

        public string Description
        {
            get { return _description; }
        }

        public string Title
        {
            get { return _video.Title; }
        }

        public string Keywords
        {
            get { return _video.Keywords; }
        }

        public ExtensionCollection<MediaThumbnail> Thumbnails
        {
            get { return _video.Thumbnails; }
        }

        public Uri WatchPage
        {
            get { return _video.WatchPage; }
        }

        public string Uploader
        {
            get { return _video.Uploader; }
        }

        public int ViewCount
        {
            get { return _video.ViewCount; }
        }

        private readonly string _thumbnailUrl;

        public string ThumbnailUrl
        {
            get { return _thumbnailUrl; }
        }

        public byte[] Thumbnail { get; set; }
    }
}